package org.example.myerp.controller;

import java.util.List;

import org.example.myerp.pojo.PageMyself;
import org.example.myerp.pojo.*;
import org.example.myerp.service.ProclassOneService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * һ������˵����Ʋ�
 * @author DELL
 *
 *///
//@CrossOrigin(methods = { RequestMethod.POST, RequestMethod.GET }, allowCredentials = "true", allowedHeaders = "*")

@RestController
@RequestMapping("/design/proclassOne")
public class ProclassOneController {
	@Autowired
    ProclassOneService proclassOneService;

	/**
	 * ��ѯȫ��һ��������Ϣ
	 * @return
	 */
	@RequestMapping("/getFindOneCslassifyAll")
	public  List<ProclassOne> getFindOneCslassifyAll(){
		List<ProclassOne> list = proclassOneService.getFindOneCslassifyAll();
		return list;
	}

	/**
	 * �����������в�ѯȫ��һ��������Ϣ����ҳ��ѯ��
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	@RequestMapping("/getProclassOnes")
	public  PageMyself<ProclassOne> getProclassOnes(Integer pageNum, Integer pageSize, String proName) {
		PageMyself<ProclassOne> getProclassOnes = proclassOneService.findOneCslassifyByPagerMessage((pageNum-1)*pageSize,pageSize,proName);
		return getProclassOnes;
	}

	/**
	 * ���һ��������Ϣ
	 * @param proName
	 * @return
	 */
	@PostMapping ("/insertOne")
	public  Integer getInsertOneCslassifyByProName(@RequestParam(value = "proName") String proName) {
        ProclassOne p = new ProclassOne();
        p.setProName(proName);
		Integer row = proclassOneService.getInsertOneCslassifyByProName(p);
		return p.getiId();
	}

	/**
	 * ����ɾ��һ��������Ϣ
	 * @param iIds
	 * @return
	 */
	@RequestMapping("/getdeleteInBatchesOneCslassifyByIIds")
	public  Integer getdeleteInBatchesOneCslassifyByIIds(Integer[] iIds) {
		Integer row = proclassOneService.getdeleteInBatchesOneCslassifyByIIds(iIds);
		return row;
	}
}
